Update backup.mdx - add restore instructions and update backup files#722
Update backup.mdx - add restore instructions and update backup files#722paula-coder-646 wants to merge 1 commit intonetbirdio:mainfrom
Conversation
- Added section about restoring a backup - Updated "Back Up" section to include all files currently generated by the installation script (traefik, crowdsec, proxy.env)
SunsetDrifter
left a comment
There was a problem hiding this comment.
Tested this end-to-end on a self-hosted lab (fresh netbird install, traefik reverse proxy, SQLite store, no CrowdSec). The restore flow conceptually works — wiping the netbird_data volume and walking the steps brought the stack back with store.db / idp.db / events.db intact and dashboard + API responding. Thanks for adding this section, it's a real gap.
A few issues I hit, ranked roughly by severity:
Bugs
-
Backup
cpis missing a destination and fails verbatim:cp -r crowdsec proxy.env traefik-dynamic.yaml
cptreats the last arg as the destination, so this errors withcp: target 'traefik-dynamic.yaml': Not a directory. It should be:cp -r crowdsec proxy.env traefik-dynamic.yaml backup/
-
Duplicate heading —
# Restore Your Self-Hosted NetBird Installationappears twice in a row in the diff. One needs to be removed. -
Heading level should be
##, not#— every other section in this page uses##(e.g.## Get In Touch). Using#makes the restore section a page-title-level header. -
Service-name inconsistency between backup and restore. The existing backup snippet uses
management:docker compose cp -a management:/var/lib/netbird/ backup/
The new restore snippet uses
netbird-server:docker compose cp -a ./backup/netbird netbird-server:/var/lib/
Current upstream installs use
netbird-server(verified on the lab —managementdoesn't exist as a service). Recommend updating the backup line tonetbird-servertoo so they match, or this PR will leave the page internally inconsistent. -
Typo: "log into the your backend" → "log into your backend".
Concerns
-
cp -r crowdsec …will hard-fail on installs without CrowdSec. The prose says it depends on install method, butcpexits non-zero before it copies the other files whencrowdsec/is absent (verified:cp: cannot stat '/home/ubuntu/crowdsec': No such file or directory). Safer to either guard each path ([ -d crowdsec ] && cp -r crowdsec backup/) or list each file separately with a note. -
Restore omits the Traefik Let's Encrypt volume. After a true disk loss,
docker compose up -dwill trigger fresh ACME requests and risk hitting LE rate limits (this is easy to do — I've seen it on this lab). The PR could either tell users to back up the*_traefik_letsencryptvolume too (docker run --rm -v <vol>:/data -v $PWD/backup:/backup alpine tar -C /data -czf /backup/traefik-le.tgz .), or at minimum warn that certs will be re-issued. -
docker compose create(no args) creates services the user may not want. On the lab, this brought up thenetbirdio/reverse-proxyservice that wasn't part of the active install (traefik was the chosen reverse proxy), and it immediately went into a restart loop. Recommend explicitly listing services, e.g.docker compose create traefik dashboard netbird-server.
Nits
- Trailing whitespace after the closing fence on the restore code block.
- The lowercase
optionally,between the two backup code blocks reads as a sentence fragment — would suggest making it a complete sentence ("Optionally, also back up …").
What worked
docker compose stop netbird-server && docker compose cp -a netbird-server:/var/lib/netbird/ backup/ && docker compose start netbird-server— clean.- After
docker volume rm <project>_netbird_data,docker compose createthendocker compose cp -a backup/netbird netbird-server:/var/lib/thendocker compose up -drestored the management server with intact identity, store, and events DBs. Dashboard returned HTTP 200, TLS cert preserved (since LE volume was kept), API responded normally.
Happy to validate any revisions if helpful.
Hi there,
First of all, thank you for the amazing project. It is really nice that your documentation caters to all user groups, not just pro-level admins, but also beginners :)
In line with this spirit, I noticed that although there is a backup section in the docs, it was missing the newer configuration files created for the netbird-proxy container, as well as the config files for the traefik and crowdsec containers.
Since partial backups can lead to headaches (e.g., needing to regenerate setup tokens for the proxy), I clarified that the backup should contain all files from the directory.
I also added a restore section, as I think it should be included, especially for newer users. I tested it and found it to be working for my setup, but I am happy for suggestions or edits, especially regarding this section.
Thank you for taking the time!
Best,
Paula
TL;DR: